using UnityEngine;
using QFramework;

namespace ProjectSurvivor
{
	public partial class SimpleCicle : ViewController
	{
		void Start()
		{
			// Code Here

			Circle.OnTriggerExit2DEvent(collider =>
			{
				var hurBox= collider.GetComponent<HurtBox>();

				if (hurBox)
				{
					if (hurBox.Owner.CompareTag("Enemy"))
					{
						hurBox.Owner.GetComponent<Enemy>().Hurt(2);
					}
				}

			}).UnRegisterWhenGameObjectDestroyed(gameObject);
		}


        private void Update()
        {
			var radius = 3;
			var degree = Time.frameCount*2;

			var circleLocalPos = new Vector2(-Mathf.Cos(degree*Mathf.Deg2Rad), Mathf.Sin(degree*Mathf.Deg2Rad))*radius;

			Circle.LocalPosition(circleLocalPos.x, circleLocalPos.y);	
        }
    }
}
